using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataHelper.BLL
{
    public class webpages_OAuthMembership
    {
        public string Provider { get; set; }
        public string ProviderUserId { get; set; }
        public int UserId { get; set; }

        #region webpages_OAuthMembershipSelectAll
        public static List<webpages_OAuthMembership> webpages_OAuthMembershipSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_OAuthMembership.webpages_OAuthMembershipSelectAll(strSearch,top,bottom,ConnectionString);
            List<webpages_OAuthMembership> webpages_OAuthMembershipList = new List<webpages_OAuthMembership>();
            while(dr.Read())
            {
                webpages_OAuthMembership mywebpages_OAuthMembership = new webpages_OAuthMembership
                {
                    Provider = !dr.IsDBNull(dr.GetOrdinal("Provider")) ? (string)dr["Provider"] : null,
                    ProviderUserId = !dr.IsDBNull(dr.GetOrdinal("ProviderUserId")) ? (string)dr["ProviderUserId"] : null,
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0
                };
                webpages_OAuthMembershipList.Add(mywebpages_OAuthMembership);
        }
        dr.Close();
        dr.Dispose();
        return webpages_OAuthMembershipList;
        }
        #endregion
        #region webpages_OAuthMembershipSelectRow
        public static webpages_OAuthMembership webpages_OAuthMembershipSelectRow(string Provider, string ProviderUserId, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_OAuthMembership.webpages_OAuthMembershipSelectRow(Provider, ProviderUserId, ConnectionString);
            webpages_OAuthMembership webpages_oauthmembership = null;

            if(dr.Read())
            {
                webpages_oauthmembership= new webpages_OAuthMembership
                {
                    Provider = !dr.IsDBNull(dr.GetOrdinal("Provider")) ? (string)dr["Provider"] : null,
                    ProviderUserId = !dr.IsDBNull(dr.GetOrdinal("ProviderUserId")) ? (string)dr["ProviderUserId"] : null,
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,

                };
            }
        dr.Close();
        dr.Dispose();
        return webpages_oauthmembership;
        }
        #endregion
        #region webpages_OAuthMembershipInsertRow
        public static void webpages_OAuthMembershipInsertRow(string Provider, string ProviderUserId, int UserId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_OAuthMembership.webpages_OAuthMembershipInsertRow(Provider, ProviderUserId, UserId, ConnectionString);
        }
        #endregion
        #region webpages_OAuthMembershipUpdateRow
        public static void webpages_OAuthMembershipUpdateRow(string Provider, string ProviderUserId, int UserId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_OAuthMembership.webpages_OAuthMembershipUpdateRow(Provider, ProviderUserId, UserId, ConnectionString);
        }
        #endregion
        #region webpages_OAuthMembershipDeleteRow
        public static void webpages_OAuthMembershipDeleteRow(string Provider, string ProviderUserId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_OAuthMembership.webpages_OAuthMembershipDeleteRow(Provider, ProviderUserId,ConnectionString);
        }
        #endregion
    }
}
